//
//  TapEnglishAppDelegate.m
//  TapEnglish
//
//  Created by 이선동 on 11. 4. 13..
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "TapEnglishAppDelegate.h"

#import "TapEnglishViewController.h"

@implementation TapEnglishAppDelegate

@synthesize window=_window;
@synthesize viewController=_viewController;
@synthesize nationCode, vocaGroup;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    nationCode = [NSNumber numberWithInt:0]; 
    vocaGroup = [[NSDictionary alloc] initWithDictionary:[self createData]];
    
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    /*
     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     */
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    /*
     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
     */
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    /*
     Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
     */
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    /*
     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
     */
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    /*
     Called when the application is about to terminate.
     Save data if appropriate.
     See also applicationDidEnterBackground:.
     */
}

- (void)dealloc
{
    [nationCode release];
    [vocaGroup release];

    [_window release];
    [_viewController release];
    [super dealloc];
}


SystemSoundID soundID;

CFURLRef baseURL;

- (void) soundPlay:(NSString *)audioName{
	NSString *sndPath = [[NSBundle mainBundle] pathForResource:audioName ofType:nil];
	baseURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:sndPath];
	AudioServicesCreateSystemSoundID(baseURL, &soundID);
	AudioServicesPlaySystemSound(soundID);
}



- (NSDictionary *) createData {
    
    NSArray *hair           = [[NSArray alloc] initWithObjects:@"hair"          , @"头发", @"tóu fa"      , @"髪の毛", @"かみ-の-け", @"머리카락", nil];
    NSArray *eyebrow        = [[NSArray alloc] initWithObjects:@"eyebrow"       , @"眉毛", @"méi mao"     , @"眉", @"まゆ", @"눈썹", nil];
    NSArray *ear            = [[NSArray alloc] initWithObjects:@"ear"           , @"耳朵", @"ĕr duo"      , @"耳", @"みみ", @"귀", nil];
    NSArray *cheek          = [[NSArray alloc] initWithObjects:@"cheek"         , @"脸颊", @"liǎn jiá"    , @"頬", @"ほお", @"뺨", nil];
    NSArray *chin           = [[NSArray alloc] initWithObjects:@"chin"          , @"下巴", @"xià ba"      , @"あご", @"あご", @"턱", nil];
    
    NSArray *finger         = [[NSArray alloc] initWithObjects:@"finger"        , @"手指", @"shǒu zhǐ"    , @"指", @"ゆび", @"손가락", nil];
    NSArray *wrist          = [[NSArray alloc] initWithObjects:@"wrist"         , @"手腕", @"shǒu wàn"    , @"手首", @"て-くび", @"손목", nil];
    NSArray *elbow          = [[NSArray alloc] initWithObjects:@"elbow"         , @"肘"  , @"zhǒu"       , @"ひじ", @"ひじ", @"팔꿈치", nil];
    NSArray *thigh          = [[NSArray alloc] initWithObjects:@"thigh"         , @"大腿", @"dà tuǐ"      , @"太股", @"ふと-もも", @"허벅지", nil];
    NSArray *knee           = [[NSArray alloc] initWithObjects:@"knee"          , @"膝盖", @"xī gài"      , @"膝", @"ひざ", @"무릎", nil];
    
    NSArray *head           = [[NSArray alloc] initWithObjects:@"head"          , @"头"  , @"tóu"        , @"頭", @"あたま", @"머리", nil];
    NSArray *eye            = [[NSArray alloc] initWithObjects:@"eye"           , @"眼睛", @"yăn jing"    , @"目", @"め", @"눈", nil];
    NSArray *nose           = [[NSArray alloc] initWithObjects:@"nose"          , @"鼻子", @"bí zi"       , @"鼻", @"はな", @"코", nil];
    NSArray *mouth          = [[NSArray alloc] initWithObjects:@"mouth"         , @"嘴"  , @"zuĭ"        , @"口", @"くち", @"입", nil];
    NSArray *neck           = [[NSArray alloc] initWithObjects:@"neck"          , @"脖子", @"bó zi"       , @"首", @"くび", @"목", nil];
    
    NSArray *shoulder       = [[NSArray alloc] initWithObjects:@"shoulder"      , @"肩膀", @"jiān bǎng"   , @"肩", @"かた", @"어깨", nil];
    NSArray *chest          = [[NSArray alloc] initWithObjects:@"chest"         , @"胸"  , @"xiōng"      , @"胸", @"むね", @"가슴", nil];
    NSArray *arm            = [[NSArray alloc] initWithObjects:@"arm"           , @"胳膊", @"gē bo"       , @"腕", @"うで", @"팔", nil];
    NSArray *stomach        = [[NSArray alloc] initWithObjects:@"stomach"       , @"肚子", @"dù zi"       , @"おなか", @"おなか", @"배", nil];
    NSArray *belly_button   = [[NSArray alloc] initWithObjects:@"belly button"  , @"肚脐", @"dù qí"       , @"へそ", @"へそ", @"배꼽", nil];
    
    NSArray *hand           = [[NSArray alloc] initWithObjects:@"hand"          , @"手"  , @"shŏu"       , @"手", @"て", @"손", nil];
    NSArray *fingernail    = [[NSArray alloc] initWithObjects:@"fingernail"    , @"指甲", @"zhǐ jia"     , @"爪", @"つめ", @"손톱", nil];
    NSArray *leg            = [[NSArray alloc] initWithObjects:@"leg"           , @"腿"  , @"tuǐ"        , @"足", @"あし", @"다리", nil];
    NSArray *foot           = [[NSArray alloc] initWithObjects:@"foot"          , @"脚"  , @"jiăo"       , @"足", @"あし", @"발", nil];
    NSArray *toe            = [[NSArray alloc] initWithObjects:@"toe"           , @"脚趾", @"jiǎo zhǐ"    , @"足の指",@"あしのゆび",  @"발가락", nil];
    
    NSArray *body           = [[NSArray alloc] initWithObjects:@"body"          , @"身体", @"shēn tǐ"     , @"体", @"からだ", @"몸", nil];
    NSArray *face           = [[NSArray alloc] initWithObjects:@"face"          , @"脸"  , @"liǎn"       , @"顔", @"かお", @"얼굴", nil];
    NSArray *calf           = [[NSArray alloc] initWithObjects:@"calf"          , @"小腿", @"xiǎo tuǐ"    , @"ふくらはぎ", @"ふくらはぎ", @"종아리", nil];
    
    
    NSDictionary *returnDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                      hair, @"hair", eyebrow, @"eyebrow", ear, @"ear", cheek, @"cheek", chin, @"chin", 
                                      finger, @"finger", wrist, @"wrist", elbow, @"elbow", thigh, @"thigh", knee, @"knee", 
                                      head, @"head", eye, @"eye", nose, @"nose", mouth, @"mouth", neck, @"neck", 
                                      shoulder, @"shoulder", chest, @"chest", arm, @"arm", stomach, @"stomach", belly_button, @"belly_button", 
                                      hand, @"hand", fingernail, @"fingernail", leg, @"leg", foot, @"foot", toe, @"toe", 
                                      body, @"body", face, @"face", calf, @"calf", nil];
    
    [hair release];
    [eyebrow release];
    [ear release];
    [cheek release];
    [chin release];
    
    [finger release];
    [wrist release];
    [elbow release];
    [thigh release];
    [knee release];
    
    [head release];
    [eye release];
    [nose release];
    [mouth release];
    [neck release];
    
    [shoulder release];
    [chest release];
    [arm release];
    [stomach release];
    [belly_button release];
    
    [hand release];
    [fingernail release];
    [leg release];
    [foot release];
    [toe release];
    
    [body release];
    [face release];
    [calf release];
    
	return returnDictionary;
}


@end
